package j03zuoye;
/*
包含出发站(startStation), 到达站(stopStation), 出发时间(startTime), 身份证号(id), 票价(price), 座位号(seat), 车次(trainNumber)属性, 火车票类包含一个打印火车票信息的方法printTicketInfo.
 */
public class Ticket {
    String startStation;
    String stopStation;
    String startTime;
    String id;
    double price;
    String seat;
    String trainNumber;

    public Ticket() {
    }

    public Ticket(String startStation, String stopStation, String startTime, String id, double price, String seat, String trainNumber) {
        this.startStation = startStation;
        this.stopStation = stopStation;
        this.startTime = startTime;
        this.id = id;
        this.price = price;
        this.seat = seat;
        this.trainNumber = trainNumber;
    }



    public void printTicketInfo(){
        System.out.println("Ticket{" +
                "startStation='" + startStation + '\'' +
                ", stopStation='" + stopStation + '\'' +
                ", startTime='" + startTime + '\'' +
                ", id='" + id + '\'' +
                ", price=" + price +
                ", seat='" + seat + '\'' +
                ", trainNumber='" + trainNumber + '\'' +
            '}'
        );
    }

    public static void main(String[] args) {
        Ticket t1 = new Ticket();
        t1.printTicketInfo();
        System.out.println("====");
        Ticket t2 = new Ticket("郑州","桂林","周五晚上","4114000.。。x",32.5,"3","k231");
        t2.printTicketInfo();


    }
}

class Point{
    int x;
    int y;

    public Point() {
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public double distanceTo(Point p){
        int disX = this.x - p.x;
        int disY = y - p.y;

        return Math.sqrt(disX*disX + disY*disY);
    }

    public void printPointInfo(){
        System.out.println("Point{" +
                "x=" + x +
                ", y=" + y +
                '}');
    }
}
class PointTest{
    public static void main(String[] args) {
        //5根号
//        System.out.println(Math.sqrt(5));
        Point p1 = new Point(100,40);
        Point p2 = new Point(3,4);

        p1.printPointInfo();
        p2.printPointInfo();

        double dis = p1.distanceTo(p2);
        System.out.println("dis = " + dis);//

    }
}